﻿using System.Collections.Generic;
using Tauren.Form.Entity.Global;
using Tauren.Form.Entity.Model;
using Tauren.Form.Entity.Output;

namespace Tauren.Form.DLL.Field_FormDLL
{
    /// <summary>
    /// 设置表单需要的表信息
    /// </summary>
    public interface IField_FormBusiness : Base.IBaseDLL
    {
        /// <summary>
        /// 分页获取信息
        /// </summary>
        /// <param name="queryModel"></param>
        /// <param name="Total"></param>
        /// <returns></returns>
        List<PageField_FormTable> Pages(QueryModel queryModel, out long Total);
        /// <summary>
        /// 主表数据
        /// </summary>
        /// <param name="ParentId"></param>
        /// <returns></returns>
        List<Form_Field_Primary_TableInfo_OutPut> GetTables(long ParentId);

        /// <summary>
        /// 子表数据
        /// </summary>
        /// <param name="ParentId"></param>
        /// <returns></returns>
        List<Form_Field_Child_TableInfo_OutPut> GetChilds(long ParentId);
        /// <summary>
        /// 判断该表是否已经设置过
        /// </summary>
        /// <param name="autoId"></param>
        /// <param name="tableCode"></param>
        /// <returns></returns>
        bool IstTableRepeat(long autoId, string CNName, string ENName);
        double GetSeq();
        /// <summary>
        /// 保存子表数据
        /// </summary>
        /// <param name="Childs"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        bool Add(List<Form_Field_Child_TableInfo> Childs);
        /// <summary>
        /// 主表数据
        /// </summary>
        /// <param name="SametableInfos"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        bool Add(List<Form_Field_Primary_TableInfo> tableInfos, long id);

        /// <summary>
        /// 根据表单获取表单需要使用的表
        /// </summary>
        /// <param name="FormId"></param>
        /// <returns></returns>
        List<Form_Field_TableInfo_OutPut> GetFormFieldTableInfos(long FormId);

        /// <summary>
        /// 根据ID 删除表信息
        /// </summary>
        /// <param name="Ids"></param>
        /// <returns></returns>
        bool DeleteTableInfos(long Ids);
        /// <summary>
        /// 获取表单字段
        /// </summary>
        /// <param name="FormId"></param>
        /// <returns></returns>
        List<Field_Form_VersionExt> GetVersionFields(long FormId,long VersionId);

        /// <summary>
        /// 获取表单需要表基础数据
        /// </summary>
        /// <param name="TableCode"></param>
        /// <returns></returns>
        List<TableFields> GetTableFields(string TableCode);

        /// <summary>
        /// 防止数据库添加重复数据
        /// </summary>
        /// <param name="Model">表单数据</param>
        /// <returns></returns>
        long UnRepeatAdd(Field_Form Model);

        /// <summary>
        /// 获取表单需要表基本信息
        /// </summary>
        /// <param name="TableCode"></param>
        /// <returns></returns>
        List<TableFields> GetTableInfos(string TableCode);
    }
}
